package com.jmemoir.authorize.security.service.impl;

import com.jmemoir.authorize.security.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * 自定义用户信息-实现类
 *
 * @author Tellsea
 * @date 2023/8/8
 */
@Slf4j
@Service
public class UserDetailsServiceImpl implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        /*User user = userRepository.findByUsername(username);
        if (user == null) {
            throw new UsernameNotFoundException("User not found");
        }*/
        log.info("查询用户信息 UserDetailsServiceImpl");
        User user = new User();
        user.setId(1L);
        user.setUsername("Tellsea");
        user.setPassword("123456");
        return user;
    }
}